import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ducafe_ui_core/ducafe_ui_core.dart';

import '../../lib/view/home/widgets/publish_bottom_sheet.dart';

void main() {
  group('Horizontal Emotion Selector Tests', () {
    testWidgets('should display horizontal emotion selector', (WidgetTester tester) async {
      await tester.pumpWidget(
        MaterialApp(
          home: Scaffold(
            body: PublishBottomSheet(),
          ),
        ),
      );

      // 验证第一页的标题存在
      expect(find.text('What\'s your mood now?'), findsOneWidget);
      expect(find.text('Select mood that reflects the most how you are feeling at this moment.'), findsOneWidget);
      
      // 验证PageView存在
      expect(find.byType(PageView), findsAtLeastNWidgets(1));
    });

    testWidgets('should navigate to content creation page after emotion selection', (WidgetTester tester) async {
      await tester.pumpWidget(
        MaterialApp(
          home: Scaffold(
            body: PublishBottomSheet(),
          ),
        ),
      );

      // 等待页面加载完成
      await tester.pumpAndSettle();

      // 点击Next Step按钮
      await tester.tap(find.text('Next Step'));
      await tester.pumpAndSettle();

      // 验证第二页的内容
      expect(find.text('Share your moment'), findsOneWidget);
      expect(find.text('Create Event'), findsOneWidget);
    });

    testWidgets('should show emotion selection with background images', (WidgetTester tester) async {
      await tester.pumpWidget(
        MaterialApp(
          home: Scaffold(
            body: PublishBottomSheet(),
          ),
        ),
      );

      await tester.pumpAndSettle();

      // 验证背景图片容器存在
      expect(find.byType(Container), findsAtLeastNWidgets(1));
      
      // 验证动画容器存在
      expect(find.byType(AnimatedContainer), findsAtLeastNWidgets(1));
      
      // 验证图片组件存在
      expect(find.byType(Image), findsAtLeastNWidgets(1));
    });
  });
}
